package com.song.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.song.mapper.UserMapper;
import com.song.pojo.User;
import com.song.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author TonySong
 * @date 2024/6/3 0003
 * @time 10:35
 */
@Service
public class UserService extends ServiceImpl<UserMapper, User> implements IUserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public IPage<User> pageList(Integer offset, Integer pagesize) {

        IPage<User> page = new Page<>(offset,pagesize);
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        IPage<User> userIPage = userMapper.selectPage(page, queryWrapper);
        return  userIPage;
    }
}
